﻿<Window x:Class="Tool12306.AutoOrderWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:src="clr-namespace:Tool12306"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        Title="自动订票工具" Height="600" Width="800" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <src:NumColorConvertor x:Key="ncc"/>
        <src:NumTextConvertor x:Key="ntc"/>
        <src:NumEnableConvertor x:Key="nec"/>
    </Window.Resources>
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Margin="5,5,5,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0">
                    <TextBlock Grid.Row="0" Text="Step1.选择需要订票的列车" FontSize="15" FontWeight="Bold" FontFamily="Microsoft YaHei" Background="#F04EBDC4" Foreground="White" Padding="5" />
                </Border>
                <ListBox Name="_ctlListTrain" Grid.Row="1" BorderThickness="0" VerticalAlignment="Stretch" MinHeight="50" IsManipulationEnabled="False" SelectionMode="Single">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <RadioButton Content="{TemplateBinding Content}"
              ContentTemplate="{TemplateBinding ContentTemplate}"
              ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
              IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}}">
                                        </RadioButton>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Name}"/>
                                <TextBlock Text="("/>
                                <TextBlock Text="{Binding Start}"/>
                                <TextBlock Text="-"/>
                                <TextBlock Text="{Binding Arrive}"/>
                                <TextBlock Text=")"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
            <Grid Grid.Row="0" Grid.Column="1" Margin="0,5,5,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0">
                    <TextBlock Text="Step2.选择座位类型" FontSize="15" FontWeight="Bold" FontFamily="Microsoft YaHei" Background="#F04EBDC4" Foreground="White" Padding="5" />
                </Border>
                <ListBox Name="_ctlListSeat" Grid.Row="1" VerticalAlignment="Stretch" MinHeight="50" IsManipulationEnabled="False" SelectionMode="Single" BorderThickness="0">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <RadioButton Content="{TemplateBinding Content}"
              ContentTemplate="{TemplateBinding ContentTemplate}"
              ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
              IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}}"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding caption}" FontFamily="Microsoft YaHei"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
            <Grid Grid.Row="1" Grid.Column="1" Margin="0,5,5,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0">
                    <TextBlock Text="Step3.选择乘车人的身份证" FontSize="15" FontWeight="Bold" FontFamily="Microsoft YaHei" Background="#F04EBDC4" Foreground="White" Padding="5"/>
                </Border>
                <ListBox Name="_ctlListPassenger" Grid.Row="1" VerticalAlignment="Stretch" IsManipulationEnabled="False" SelectionMode="Multiple" BorderThickness="0">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <CheckBox Content="{TemplateBinding Content}"
              ContentTemplate="{TemplateBinding ContentTemplate}"
              ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
              IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}}"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding passenger_name}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
            <HeaderedContentControl Grid.Row="2" Grid.ColumnSpan="2" Margin="5,5,5,5">
                <HeaderedContentControl.Header>
                    <TextBlock Text="Step4.根据日期订购" FontSize="15" FontWeight="Bold" FontFamily="Microsoft YaHei" Background="#F04EBDC4" Foreground="White" Padding="5" Margin="0,5,0,0" />
                </HeaderedContentControl.Header>
                <ScrollViewer Padding="0" Margin="0" VerticalScrollBarVisibility="Auto">
                    <WrapPanel Name="_ctlWrapPanel" Height="120"/>
                </ScrollViewer>
            </HeaderedContentControl>
        </Grid>
        <Border Name="_borderMask" Background="#A5000000" Visibility="Collapsed">
            <Border CornerRadius="5" BorderThickness="5" BorderBrush="#FFFFC300" HorizontalAlignment="Center" Background="#FFFFC300" VerticalAlignment="Center" Opacity="0.9">
                <Border CornerRadius="5" BorderBrush="White" BorderThickness="5" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Grid Background="White">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="/Tool12306;component/Resources/WAITE.jpg" Width="200" Height="200" Stretch="UniformToFill"/>
                        <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="250" Margin="-30,0,0,0">
                            <TextBlock Text="订购中..." FontSize="24" FontWeight="Bold" Margin="5" HorizontalAlignment="Center" FontFamily="Microsoft Yahei,NSimSun" />
                            <TextBlock Name="_ctlTextLog" Text="消息" HorizontalAlignment="Center" FontSize="18" Margin="5"/>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                <TextBlock Text="已尝试" FontSize="18"/>
                                <TextBlock Name="_ctlTextTry" Text="x" FontWeight="Bold" FontSize="18" Margin="5,0,5,0"/>
                                <TextBlock Text="次!" FontSize="18"/>
                            </StackPanel>
                            <Button Name="_ctlBtnCancel" Content="取消" Click="_ctlBtnCancel_Click" Margin="10" Height="30"/>
                        </StackPanel>
                    </Grid>
                </Border>
            </Border>
        </Border>
    </Grid>
</Window>
